<template>
  <div class="container">
    <h1 class="study-detail-title">{{detail.title}}</h1>
    <div class="detail-content">
     <p v-html="detail.content"></p>
    </div>
  </div>
</template>

<script>
  export default {
    name: "study-notice-detail",
    data() {
      return {
        type:'',
        id: '',
        detail: '',
      }
    },
    created() {
      this.type = this.$route.query.type;
      this.id = this.$route.query.id;
      this.getDetail();
    },
    methods: {
      getDetail() {
        let that = this;
        let url = that.type === 'notice' ? '/mobile/Gonggao/detail' : '/mobile/Gonggao/zydetail';
        let typeObj = {
          notice: '/mobile/Gonggao/detail',
          task: '/mobile/Gonggao/zydetail',
          msg: '/mobile/Stmsg/detail',
        };
        console.log(typeObj[that.type]);
        that.$api.post(typeObj[that.type],{'user':{'id': that.id}}, r => {
          that.detail = r.data;
        })
      }
    }
  }
</script>

<style scoped>
  .study-detail-title {
    padding: .2rem 12px;
    font-size: .34rem;
    font-weight: normal;
    line-height: 1.5;
    text-align: center;
    border-bottom: 1px solid #e9ecec;
  }
  .detail-content {
    padding: 12px;
    font-size: .28rem;
    line-height: 1.5;
    color: #666666;
  }
</style>
